"""
admin后台相关接口
"""
from flask import Blueprint, render_template
from flask import Flask, request, make_response, session, g
from werkzeug.security import generate_password_hash, check_password_hash
from src.utils import exceptions, response_, verification


iot_admin_bp = Blueprint('iot_admin', __name__, url_prefix='/admin')


@iot_admin_bp.route('/')
def index():
    # 菜单结构数据
    menu_structure = {
        "首页": {"has_submenu": False},
        "企业管理": {
            "has_submenu": True,
            "submenu": ["企业信息", "用户管理", "角色权限"]
        },
        "设备管理": {
            "has_submenu": True,
            "submenu": ["设备类型", "产品分类", "产品管理", "产品固件"]
        },
        "系统设置": {
            "has_submenu": True,
            "submenu": ["系统配置", "系统监控", "系统工具"]
        },
        "平台服务": {
            "has_submenu": True,
            "submenu": ["API管理", "接口配置", "服务监控"]
        },
        "植保服务": {
            "has_submenu": True,
            "submenu": ["病虫害管理", "预防措施", "专家系统"]
        },
        "数据统计": {
            "has_submenu": True,
            "submenu": ["设备统计", "运行分析", "预警统计"]
        },
        "系统管理": {
            "has_submenu": True,
            "submenu": ["权限管理", "日志审计", "系统备份"]
        }
    }

    return render_template('index.html', menu_structure=menu_structure)
